﻿
using System.Threading;
namespace Eswat
{
	/// <summary>
	/// Testing context for a test.
	/// </summary>
	/// <typeparam name="T">The type of the test target.</typeparam>
	public class TestContext<T> : ITestContext<T>
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="TestContext&lt;T&gt;"/> class.
		/// </summary>
		/// <param name="testTarget">The test target.</param>
		/// <param name="templateSource">The template source.</param>
		/// <param name="template">The template.</param>
		public TestContext(
			T testTarget,
			string templateSource,
			string template)
		{
			this.Target = testTarget;
			this.Template = template;
			this.Services = DefaultTestServiceAccessor.Instance;
		}

		/// <summary>
		/// Gets the test target.
		/// </summary>
		public T Target { get; private set; }

		/// <summary>
		/// Gets the template source.
		/// </summary>
		public string TemplateSource { get; private set; }

		/// <summary>
		/// Gets the test template.
		/// </summary>
		public string Template { get; private set; }

		/// <summary>
		/// Gets the services.
		/// </summary>
		public dynamic Services { get; private set; }

		/// <summary>
		/// Waits the specified milliseconds.
		/// </summary>
		/// <param name="milliseconds">The milliseconds.</param>
		public void Wait(int milliseconds)
		{
			Thread.Sleep(milliseconds);
		}
	}
}
